import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class StartFrame extends JFrame implements ActionListener
{

	private JPanel contentPane;
	private JButton btnJoinPlay;
	private JButton btnCreatePlay;
	
	public StartFrame()
	{
		setBounds(100, 100, 300, 174);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		btnJoinPlay = new JButton("Join Game");
		btnJoinPlay.addActionListener(this);
		btnJoinPlay.setBounds(35, 11, 213, 38);
		contentPane.add(btnJoinPlay);
		
		btnCreatePlay = new JButton("Create New Game");
		btnCreatePlay.addActionListener(this);
		btnCreatePlay.setBounds(35, 68, 213, 38);
		contentPane.add(btnCreatePlay);
	}

	@Override
	public void actionPerformed(ActionEvent e)
	{
		String action = e.getActionCommand();
		if( action=="Join Game"){
			JoinGameFrame joinFrame = new JoinGameFrame();
			joinFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
			joinFrame.setVisible(true);
			dispose();
		}
		else if( action == "Create New Game"){
			GameFrame newFrame = new GameFrame();
			newFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
			newFrame.setVisible(true);
			dispose();
		}
		
	}
}
